<script setup>
    import { ref } from "vue"
    const imgList = [
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-00.gif",
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-01.gif",
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-02.gif",
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-03.gif",
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-04.png",
      "https://cxk-1305128831.cos.ap-beijing.myqcloud.com/11-05.png",
    ]
    let index = ref(0)
</script>

<template>
  <div class="container">
    <div class="buttom">
      <button @click="index--" v-show="index>0">上一页</button>
    </div>
    <img :src="imgList[index]" alt="img not found!" width="200px">
    <div class="buttom">
      <button @click="index++" v-show="index < imgList.length - 1">下一页</button>
    </div>
  </div>
</template>

<style scoped>
  .container {
    width: 400px;
    height: 200px;

    /* 1.使用弹性布局 */
    display: flex;
    flex-direction: row;
    align-items: center;
  }
  .container .buttom {
    flex: 1;
    display: flex;
    justify-content: center;
  }
  .container img {
    flex: 1;
  }

</style>